//package org.example.batchutils.utils;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
//import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
//import com.baomidou.dynamic.datasource.provider.AbstractDataSourceProvider;
//import org.example.batchutils.mapper.DataSourceMapper;
//import org.example.batchutils.pojo.DataSourcePojo;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.sql.DataSource;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Component
//@DS("master")
//public class DynamicDataSourceProvider extends AbstractDataSourceProvider {
//
//
//
//
//    private final Map<String, DataSourceProperty> dataSourcePropertiesMap;
//
//    public DynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator) {
//        super(defaultDataSourceCreator);
////        Map<String, DataSourceProperty> dataSourcePropertyMap=new HashMap<>();
////        List<DataSourcePojo> dataSourcePojos = dataSourceMapper.getDataSource();
////        dataSourcePojos.forEach(dsp->{
////            DataSourceProperty property = new DataSourceProperty();
////            property.setUsername(dsp.getUsername());
////            property.setPassword(dsp.getPassword());
////            property.setUrl(dsp.getUrl());
////            property.setDriverClassName(dsp.getDriverClassName());
////            dataSourcePropertyMap.put(dsp.getPollName(),property);
////        });
//        this.dataSourcePropertiesMap = defaultDataSourceCreator;
//    }
//    @Override
//    public Map<String, DataSource> loadDataSources(DefaultDataSourceCreator defaultDataSourceCreator) {
//        return createDataSourceMap();
//    }
//}
